using System.Threading.Tasks;
using UniversalAdmin.Domain.Entities;

namespace UniversalAdmin.Domain.Interfaces
{
    /// <summary>
    /// JWT服务接口
    /// </summary>
    public interface IJwtService
    {
        /// <summary>
        /// 生成JWT令牌
        /// </summary>
        /// <param name="user">用户信息</param>
        /// <param name="rememberMe">是否记住登录</param>
        /// <returns>JWT令牌字符串</returns>
        string GenerateToken(User user, bool rememberMe = false);
        
        /// <summary>
        /// 验证JWT令牌
        /// </summary>
        /// <param name="token">JWT令牌</param>
        /// <returns>是否有效</returns>
        bool ValidateToken(string token);
        
        /// <summary>
        /// 从令牌中获取用户ID
        /// </summary>
        /// <param name="token">JWT令牌</param>
        /// <returns>用户ID</returns>
        Task<string> GetUserIdFromTokenAsync(string token);
    }
}